<?php
$PurviewLevel=0;
require("../../inc/common.inc.php");
require_once(dirname(__FILE__)."/../"."Admin_ChkPurview.php");
if($cid=="tmsgid"||$cid=="rmsgid"){
$msginfo = $db->getinfo("select * from mx_sucai_msg where mid='$id' limit 1");
$mpic = $db->getinfo("select fpath from mx_sucai_file where fid = ".$msginfo["mpic"]." limit 1");
$msginfo["mpic"] = $mpic["fpath"];
$mtypestr = $msginfo["mtype"]==1?"多图文":"单图文";
$returnstr = '<table width="80%" border="0" align="left" cellpadding="9" cellspacing="0">
                    
                    <tr>
                      <td width="134" align="right" class="font14">信息内容：</td>
                      <td colspan="2"><table width="100%" border="0" align="center" cellpadding="9" cellspacing="1" bgcolor="#CCCCCC" class="stripe">
			  <tr>
                <th width="15%" align="center" class="table_ti">信息类型</th>
				<th align="center" class="table_ti">标题</th>
				<th width="15%" align="center" class="table_ti">封面</th>
                <th width="15%" align="center" class="table_ti">添加时间</th>
			  </tr>
			  <tr>
				<td align="center" bgcolor="#FFFFFF" class="font14">'.$mtypestr.'</td>
				<td align="left" bgcolor="#FFFFFF" class="font14">'.wordscut($msginfo["mtitle"],80,"...").'</a></td>
				<td align="center" bgcolor="#FFFFFF"><img src="'.get_photourl($mpic["fpath"]).'" style="max-width:100px;"/></td>
				<td align="center" bgcolor="#FFFFFF" class="font12">'.date("Y-m-d",$msginfo["addtime"]).'</td>
			  </tr>';
if($msginfo["mtype"]==1){
	$smsgquery = $db->excu("select * from mx_sucai_msg where fid=".$msginfo["mid"]." order by addtime,mid");
	
	while($smsgarr = $db->fetch_array($smsgquery)){
		$mpic = $db->getinfo("select fpath from mx_sucai_file where fid = ".$smsgarr["mpic"]." limit 1");
		$returnstr.='<tr>
				<td align="center" bgcolor="#FFFFFF" class="font14"></td>
				<td align="left" bgcolor="#FFFFFF" class="font14">'.wordscut($smsgarr["mtitle"],80,"...").'</a></td>
				<td align="center" bgcolor="#FFFFFF"><img src="'.get_photourl($mpic["fpath"]).'" style="max-width:100px;"/></td>
				<td align="center" bgcolor="#FFFFFF" class="font12">'.date("Y-m-d",$smsgarr["addtime"]).'</td>
			  </tr>';
	}
}
$returnstr.='</table></td>
                    </tr>
                    </table>';


$msginfo["returnstr"] = $returnstr;
$msginfo["cid"]=$cid;
$result = json_encode($msginfo);
echo $result;
exit;
}else{
$sucaiinfo = $db->getinfo("select * from mx_sucai_file where fid='$id' limit 1");
$sucaiinfo["cid"]=$cid;
$result = json_encode($sucaiinfo);
echo $result;
exit;
}
?>